import { Sequelize, DataTypes } from 'sequelize'
import moment from 'moment'
import sequelize from './sequelize'

// 返校审批
const FanxiaoshenpiModel = sequelize.define('FanxiaoshenpiModel', {
	id: {
		type: DataTypes.BIGINT,
		primaryKey: true,
		autoIncrement: true,
		allowNull: false,
		comment: '主键id'
	},
	xuehao: {
		type: DataTypes.STRING,
		defaultValue: '',
		allowNull: true,
		comment: '学号'
	},
	xingming: {
		type: DataTypes.STRING,
		defaultValue: '',
		allowNull: true,
		comment: '姓名'
	},
	zhaopian: {
		type: DataTypes.TEXT,
		defaultValue: '',
		allowNull: true,
		comment: '照片'
	},
	yuanxi: {
		type: DataTypes.STRING,
		defaultValue: '',
		allowNull: true,
		comment: '院系'
	},
	banji: {
		type: DataTypes.STRING,
		defaultValue: '',
		allowNull: true,
		comment: '班级'
	},
	fanxiaoriqi: {
		type: DataTypes.DATEONLY,
		allowNull: true,
		get() {
            return moment(this.getDataValue('fanxiaoriqi')).format('YYYY-MM-DD')
        },
		comment: '返校日期'
	},
	jiankangma: {
		type: DataTypes.TEXT,
		defaultValue: '',
		allowNull: true,
		comment: '健康码'
	},
	youwuyichang: {
		type: DataTypes.TEXT,
		defaultValue: '',
		allowNull: true,
		comment: '有无异常'
	},
	sfsh: {
		type: DataTypes.STRING,
		defaultValue: '',
		allowNull: true,
		comment: '是否审核'
	},
	shhf: {
		type: DataTypes.TEXT,
		defaultValue: '',
		allowNull: true,
		comment: '审核回复'
	},
	addtime: {
  		type: DataTypes.DATE,
  		defaultValue: DataTypes.NOW,
    	allowNull: false,
    	get() {
            return moment(this.getDataValue('addtime')).format('YYYY-MM-DD HH:mm:ss')
        },
		comment: '添加时间'
	}
}, {
	timestamps: false,
	freezeTableName: true,
	tableName: 'fanxiaoshenpi'
})

export default FanxiaoshenpiModel
